<!--
直播分类增加
 add by yyp 2019-05-17
-->
<template lang="pug">
  kalix-dialog.user-add(bizKey="Classify" ref="kalixBizDialog"
  v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot" style=" width:60%;margin:auto;")
      el-form-item(label="直播分类名称" prop="name" label-width="120px" v-bind:rules="rules.name")
        el-input(v-model="formModel.name" style="width:80%")
      el-form-item.short(label="直播封面图片" prop="imgUrl" v-bind:label-width="labelWidth")
        kalix-clansman-upload(:action="action" v-on:filePath="getFilePath" fileType="img" tipText="只能上传jpg/png文件")
</template>

<script type="text/ecmascript-6">
  import FormModel from './model'
  import {ClassifyURL} from '../../config.toml'
  import KalixClansmanUpload from '../../../../../components/fileUpload/upload'
  import {baseURL} from '../../../../../config/global.toml'
  import KalixSelect from '../../../../../components/corelib/components/common/baseSelect'
  export default {
    name: 'classifyAdd',
    components: {KalixSelect, KalixClansmanUpload},
    data() {
      return {
        formModel: Object.assign({}, FormModel),
        action: baseURL + '/camel/rest/upload',
        rules: {
          name: [{required: true, message: '请输入名称', trigger: 'blur'}]
        },
        targetURL: ClassifyURL,
        labelWidth: '110px'
      }
    },
    methods: {
      getFilePath(filePath, fileName) {
        console.log('--getFilePath---', filePath)
        console.log('--fileName---', fileName)

        this.formModel.imgUrl = filePath
        this.formModel.imgName = fileName
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">
  .el-form
    width 70%
    margin auto
    .el-input
      width 70%
    .radio
      margin-left 20px
      .el-radio
        color: #3465cb
        font-weight: bold
        font-size: 14px
</style>
